app.controller('roleController', ['$scope', 'httpWrapService', 'dialogs', '$state', '$stateParams','AppConstants','TableFactory', function($scope, httpWrapService, dialogs, $state, $stateParams, AppConstants,TableFactory) {

	$scope.params = {};
	var role = $scope.params.role = {
			field : 'role',
			type : AppConstants.filter.CONTAINS,
			term : ''
	};
	var name = $scope.params.name = {
			field : 'cname',
			type : AppConstants.filter.CONTAINS,
			term : ''
	};
	var remarks = $scope.params.remarks = {
			field : 'remarks',
			type : AppConstants.filter.CONTAINS,
			term : ''
	};
	
    $scope.Table1 = TableFactory.newInstance({
		url : 'system/role/list.do',
		params : [role, name, remarks]
	});
    $scope.Table1.load();

    $scope.deleteRole = function(id) {
    	//$scope.Table1, id 这两个参数是为了在点击删除按钮后，禁用删除按钮
        httpWrapService.defaultFootTableDelete($scope.Table1, id, 'system/role/delete/'+ id +'.do',{},'是否确定要删除数据字典？').then(function(res){
        	$scope.Table1.load();
        });
    };

}]);